#ifndef __MEMORY_TOP_H__
#define __MEMORY_TOP_H__

#include <systemc>

#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
#include "tlm_utils/simple_target_socket.h"

using namespace sc_core;
using namespace sc_dt;
using namespace std;
using namespace tlm_utils;

class memory_top: public sc_core::sc_module{

public:
  SC_HAS_PROCESS(memory_top);
  tlm_utils::simple_target_socket<memory_top> socket;

  enum {SIZE = 256};

  memory_top(const sc_module_name& name): socket("socket"){
    socket.register_b_transport(this, &memory_top::b_transport);
    for(int i = 0; i < SIZE; i++) {
      mem[i] = 0xAA000000 | (rand() % SIZE);
    }
  }
  virtual void b_transport(tlm::tlm_generic_payload& trans, sc_time& delay);

private:
  int mem[SIZE];

};

#endif /* __MEMORY_TOP_H__ */
